<?php
namespace Common\Model;
use Think\Model;

/**
 * Class SinglepageModel
 * @package Common\Model
 * 单页
 */
class SinglepageModel extends BaseModel{

    public $pix = "";
    public $fieldsStr = '*';
    public $orderStr = 'id asc';

    public function checked_need_add($pid){
        $map['parentid'] = array('eq', $pid);
        $one = $this->where($map)->find();
        if(!$one){
            return $this->add_new_one($pid);
        }
        return false;
    }

    private function add_new_one($pid){
        $data['parentid'] = $pid;
        return $this->add($data);
    }

}